home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / MOR55SRC.ZIP / MORIA / SOURCE / MISC4.C < prev    next >
C/C++ Source or Header  |  1992-12-07  |  3KB  |  109 lines

  1. /* source/misc4.c: misc code for maintaining the dungeon, printing player info
  2.  
  3.    Copyright (c) 1989-92 James E. Wilson, Robert A. Koeneke
  4.  
  5.    This software may be copied and distributed for educational, research, and
  6.    not for profit purposes provided that this copyright and statement are
  7.    included in all such copies. */
  8.  
  9. #ifdef __TURBOC__
  10. #include    <stdio.h>
  11. #endif
  12.  
  13. #include "config.h"
  14. #include "constant.h"
  15. #include "types.h"
  16. #include "externs.h"
  17.  
  18. #ifndef USG
  19. #include <sys/types.h>
  20. #include <sys/param.h>
  21. #endif
  22.  
  23. #ifdef USG
  24. #ifndef ATARIST_MWC
  25. #include <string.h>
  26. #endif
  27. #else
  28. #include <strings.h>
  29. #endif
  30.  
  31.  
  32. /* Add a comment to an object description.        -CJS- */
  33. void scribe_object()
  34. {
  35.   int item_val, j;
  36.   vtype out_val, tmp_str;
  37.  
  38.   if (inven_ctr > 0 || equip_ctr > 0)
  39.     {
  40.       if (get_item(&item_val, "Which one? ", 0, INVEN_ARRAY_SIZE, CNIL, CNIL))
  41.     {
  42.       objdes(tmp_str, &inventory[item_val], TRUE);
  43.       (void) sprintf(out_val, "Inscribing %s", tmp_str);
  44.       msg_print(out_val);
  45.       if (inventory[item_val].inscrip[0] != '\0')
  46.         (void) sprintf(out_val, "Replace %s New inscription:",
  47.                inventory[item_val].inscrip);
  48.       else
  49.         (void) strcpy(out_val, "Inscription: ");
  50.       j = 78 - strlen(tmp_str);
  51.       if (j > 24)
  52.         j = 12;
  53.       prt(out_val, 0, 0);
  54.       if (get_string(out_val, 0, (int)strlen(out_val), j))
  55.         inscribe(&inventory[item_val], out_val);
  56.     }
  57.     }
  58.   else
  59.     msg_print("You are not carrying anything to inscribe.");
  60. }
  61.  
  62. /* Append an additional comment to an object description.    -CJS- */
  63. void add_inscribe(i_ptr, type)
  64. inven_type *i_ptr;
  65. int8u type;
  66. {
  67.   i_ptr->ident |= type;
  68. }
  69.  
  70. /* Replace any existing comment in an object description with a new one. CJS*/
  71. void inscribe(i_ptr, str)
  72. inven_type *i_ptr;
  73. char *str;
  74. {
  75.   (void) strcpy(i_ptr->inscrip, str);
  76. }
  77.  
  78.  
  79. /* We need to reset the view of things.            -CJS- */
  80. void check_view()
  81. {
  82.   register int i, j;
  83.   register cave_type *c_ptr, *d_ptr;
  84.  
  85.   c_ptr = &cave[char_row][char_col];
  86.   /* Check for new panel           */
  87.   if (get_panel(char_row, char_col, FALSE))
  88.     prt_map();
  89.   /* Move the light source           */
  90.   move_light(char_row, char_col, char_row, char_col);
  91.   /* A room of light should be lit.     */
  92.   if (c_ptr->fval == LIGHT_FLOOR)
  93.     {
  94.       if ((py.flags.blind < 1) && !c_ptr->pl)
  95.     light_room(char_row, char_col);
  96.     }
  97.   /* In doorway of light-room?           */
  98.   else if (c_ptr->lr && (py.flags.blind < 1))
  99.     {
  100.       for (i = (char_row - 1); i <= (char_row + 1); i++)
  101.     for (j = (char_col - 1); j <= (char_col + 1); j++)
  102.       {
  103.         d_ptr = &cave[i][j];
  104.         if ((d_ptr->fval == LIGHT_FLOOR) && !d_ptr->pl)
  105.           light_room(i, j);
  106.       }
  107.     }
  108. }
  109.